home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / comm / ytsg3.zip / YTSG.DOC < prev    next >
Text File  |  1996-02-01  |  8KB  |  224 lines

  1.  
  2.  
  3.                            YTSG and YTSGDOS
  4.  
  5. ytsg.c - Convert Yarn files to SOUP offline reader format using grep
  6.          syntax to select messages.
  7.  
  8. Copyright (C) 1995, Richard Curry Consulting: trindflo@fishnet.net All
  9. Rights Reserved
  10.  
  11. My software is generally available as free software under the terms of
  12. the GNU General Public License.
  13.  
  14. Parts of this software were copied from source code made available as
  15. part of IBM's Developer's Connection.  IBM copyright information has been
  16. retained in the source.
  17.  
  18. This program is distributed in the hope that it will be useful, but
  19. WITHOUT ANY WARRANTY; without even the implied warranty of
  20. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  21. General Public License for more details.
  22.  
  23. You should have received a copy of the GNU General Public License along
  24. with the source code to this program in a file name 'COPYING'; if not,
  25. write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
  26. 02139, USA.
  27.  
  28. SUMMARY:
  29.  
  30.    This file contains the code to translate/copy Yarn news files into
  31.    soup offline reader format.  This initially is intended to allow
  32.    cleanup of a corrupted Yarn newsbase.
  33.  
  34.    The original program was designed for use with the IBM CSET/2
  35.    compiler.  Parts have been removed and generally performance was
  36.    degraded to conform with a DOS environment.
  37.  
  38. Usage:
  39.     ytsg [-vio] {Pattern | -e Pattern | -f StringFile} [YarnFile]
  40.  
  41. Flags:
  42.     -e Pattern    Specifies a pattern.
  43.     -f StringFile Specifies a file that contains strings to be matched.
  44.     -i            Ignores the case of letters when making comparisons.
  45.     -o            Output the offset of each msg as found
  46.     -v            Displays all lines except those that match pattern.
  47.     -y            Ignore case of letters when making comparisons.
  48.  
  49.  
  50. The ytsg command searches the input file specified by the *YarnFile*
  51. parameter (standard input by default) for news/mail messages matching a
  52. pattern.
  53.  
  54. The ytsg command searches specifically for *Pattern* parameters that are
  55. fixed strings.  Note they are not regular expressions, just fixed
  56. strings! A real regular expression parser here might be nice, but for
  57. now it is not to be.  I have added one special case here: a single
  58. string of * will cause all messages to be selected.
  59. Example:
  60. ytsg * 19226
  61.  
  62. The ytsg command outputs the message containing the matched line to soup
  63. formatted files.  The pattern that you are matching must be in the first
  64. 50,000 bytes of the article (for DOS or the first 64K for OS/2).
  65.  
  66. In addition, the string 'Newsgroups:' is searched for.  This line is
  67. searched for strings which already exist in your newsrc file.  If no
  68. Newsgroups string is found, the message is formatted into email format.
  69. If no string in your newsrc file matches the Newsgroups string, then the
  70. message is identified as belonging to the first group named in the
  71. Newsgroups line.  This search will recognize and ignore the
  72. 'X-Newsgroups' line added by Yarn version .85.
  73.  
  74. The exit values of this command are:
  75.   0   A match was found
  76.   1   No match was found
  77.   2   A syntax error was found or a file was inaccessible (even if matches were
  78.       found).
  79.  
  80. Flags:
  81.       -e Pattern    Specifies a pattern.  This works the same as a simple
  82.                     pattern, but is useful when a pattern begins with a -.
  83.  
  84.       -f StringFile Specifies a file that contains strings to be matched.
  85.                     (The file may specify up to 256 strings in this
  86.                     implementation).
  87.  
  88.       -i            Ignores the case of letters when making comparisons.
  89.  
  90.       -o            Outputs the HEX offset of each message.  First message is
  91.                     at offset 0.
  92.  
  93.       -v            Output all messages except those that match the specified
  94.                     pattern.
  95.  
  96.  
  97. SETUP:
  98.  
  99. With thanks to several Yarn users who have BETA tested and suggested
  100. improvements for this software.
  101.  
  102. You need to have your HOME environment variable set.  The program uses
  103. this to locate your newsrc file.
  104.  
  105. You need to have a newsrc file.  It can be an empty file, but you should
  106. probably use the one you had.  I use the the newsrc file to group the
  107. messages into groups that you probably want to see.  If I don't know
  108. which what groups you use, I just go with the first thing on the
  109. Newsgroups line of the message.  So you will end up seeing strange
  110. newsgroups which you never subscribed to appear in Yarn because of
  111. cross-posting.  I don't use any of the numeric information in the newsrc
  112. file, but I do pay attention to the ':' and '!' marks.
  113.  
  114. Certain errors will crash ytsg after the AREAS file has already been
  115. created.  As a safety mechanism, ytsg will always terminate if an AREAS
  116. file already exists in the directory.  If the AREAS file resulted from a
  117. a crashed or terminated run, just delete the AREAS file.
  118.  
  119.  
  120. USES:
  121.  
  122. As stated earlier, this program was initially intended to allow cleanup
  123. of a corrupted Yarn newsbase.  All of the files in the %YARN%\news
  124. directories are converted back into SOUP files and the whole lot is
  125. imported into a fresh copy of Yarn.  The 'Grep' or search capability was
  126. later added and allows limited filtering of a newsbase: this has been
  127. used to manipulate pseudo-newsgroups created with the "newgroup" command
  128. for email filtering.
  129.  
  130. INBOX and folder files can also be processed by ytsg with a warning:
  131. they will go back to whatever groups they originated from.  This means a
  132. message in a folder which originally was part of a newsgroup will be
  133. imported into that newsgroup.  A message without a Newsgroups: line will
  134. be imported into email -- this includes email messages 'filtered' by
  135. Yarn into pseudo-newsgroups even if the message contains a Newgroups:
  136. line.
  137.  
  138. Search strings have been added allowing the tool to be used to split
  139. newsbases based on strings in the messages.
  140.  
  141. A DOS version was added.
  142.  
  143. A bug was fixed when the string "Newsgroups:" occurred in the body of a
  144. message.
  145.  
  146. A bug was fixed so that strings like "X-Newsgroups:" (added in Yarn
  147. version .85) would be ignored: in previous versions of ytsg messages
  148. containing these lines would be erroneously identified as usenet news
  149. messages instead of email which they actually are.
  150.  
  151.  
  152. EXAMPLES:
  153.  
  154.      Full rebuild:
  155.  
  156. This software is fully tested and nothing can go wrong.  So first we
  157. make a copy...
  158.  
  159. SET YARN=H:\OLDYARN
  160. SET HOME=H:\OLDYARN\RRC
  161.  
  162. cd %YARN%\news
  163.  
  164. for %c in (*) do makesoup %c
  165.  
  166. SET YARN=H:\newYARN
  167. SET HOME=H:\newYARN\RRC
  168.  
  169. clearall
  170.  
  171. makegps
  172.  
  173. for %c in (H:\OLDYARN\news*.zip) do import %c
  174.  
  175. - Finis -
  176.  
  177.  
  178.      Refilter INBOX (filenames need to be shortened for DOS)
  179.  
  180. SET YARN=H:\YARN
  181. SET HOME=H:\YARN\RRC
  182.  
  183. cd %HOME%\mail
  184. copy INBOX INBOX.sav
  185. makesoup INBOX
  186. cd %YARN%
  187. import %HOME%\mail\newsINBOX.zip
  188.  
  189. - Finis -
  190.  
  191.  
  192.  
  193. -Begin makesoup.cmd (or .bat -- note the filenames can get too long for DOS) --
  194. ytsg * %1
  195. zip -m news%1.zip AREAS *.MSG
  196. rem same line for pkzip
  197. erase %1
  198. -End -- Cut -------------------------------------------------------------------
  199.  
  200.  
  201. -Begin clearall.cmd (I think this works in a .bat)-----------------------------
  202. cd %YARN%
  203. del history.*
  204. del supersed.*
  205. del active
  206. del overview
  207. del news
  208.  
  209. cd %HOME%\yarn
  210. del readart.*
  211. del newsrc
  212. -End -- Cut -------------------------------------------------------------------
  213.  
  214. -Begin makegps.cmd (only a small excerpt.  mine has over 200 lines.) ----------
  215. newgroup junk 14
  216. newgroup list.yarn 9999 9999 yarn-list@lists.colorado.edu
  217. newgroup rain.local.general 9999
  218. newgroup rain.local.rain-l 9999
  219. newgroup rain.local.help 9999
  220. newgroup tri.politics 9999
  221. newgroup tri.politics.sb 9999
  222. -End -- Cut -------------------------------------------------------------------
  223.  
  224.